// 该文件用于打包

/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'

/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

/* import icons and add all Library */
import { fas } from '@fortawesome/free-solid-svg-icons'

library.add(fas)

// 引入样式
import './styles/index.scss'

// 引入自定义组件
import Icon from './components/Icon/Icon.vue'
import Button from './components/Button/Button.vue'
import Card from './components/Card/Card.vue'
import Dialog from './components/Dialog/Dialog.vue'
import Pager from './components/Pager/Pager.vue'
import Collapse from './components/Collapse/Collapse.vue'
import CollapseItem from './components/Collapse/CollapseItem.vue'
import Tooltip from './components/Tooltip/Tooltip.vue'
import Dropdown from './components/Dropdown/Dropdown.vue'

const components = [Icon, Button, Card, Dialog, Pager, Collapse, CollapseItem, Tooltip, Dropdown]
// 对外提供install方法
const install = (app) => {
  // app会被自动注入
  components.forEach((component) => app.component(component.name, component))
  // 添加图标组件
  app.component('font-awesome-icon', FontAwesomeIcon)
}

// 导出
// 分为两种：全部导出和按需导出

export default install

export {
  install,
  Icon,
  Button,
  Card,
  Dialog,
  Pager,
  Collapse,
  CollapseItem,
  Tooltip,
  Dropdown,
  FontAwesomeIcon,
}
